package com.gzz.orchid.context.infrastructure.definition;

import com.gzz.orchid.common.core.support.IBaseEnum;

/**
 * @author higmd
 */

public enum TradeStatus implements IBaseEnum {
    WAIT_PAY(1,"待支付"),
    WAIT_SHIP(2,"待发货"),
    WAIT_REP(3,"待收货"),
    FINISHED(4,"已完成"),
    CLOSED(5,"已关闭"),
    AFTER_SERVICING(6, "售后中"),
    SERVICE_COMPLETED(7, "售后中");

    private final int code;
    private final String text;

    TradeStatus(int code, String text) {
        this.code = code;
        this.text = text;
    }

    public static TradeStatus parse(int val) {
        for (TradeStatus e : TradeStatus.values()) {
            if (e.code == val) {
                return e;
            }
        }
        throw new IllegalArgumentException("Invalid TradeType value: " + val);
    }

    public static TradeStatus of(String name) {
        return Enum.valueOf(TradeStatus.class, name);
    }

    @Override
    public Integer getValue() {
        return code;
    }

    @Override
    public String getLabel() {
        return text;
    }
}
